package com.cskaoyan;

import com.cskaoyan.bean.City;
import com.cskaoyan.mapper.CityMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class MybatisMain {

    public static void main(String[] args) {

        SqlSession sqlSession = MybatisUtils.getSqlSession();

        // 这个cityMapper是一个代理对象
        // 什么叫代理对象呢？其实就是Mybatis给我们生成的一个CityMapper的实现类
        CityMapper cityMapper = sqlSession.getMapper(CityMapper.class);

        City city = cityMapper.selectCityById(2);

        System.out.println(city);

    }
}
